/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package clue.players.ai;

/**
 *
 * @author Shawn
 */
public class EnumerateTest {



  public static int enumerate(int w, int s, int r) {
    // R = 9
    // W = 6
    // S = 6
    int tally = 0;
    // choose one of each remaining
    int remainingR = 9 - r;
    int remainingW = 6 - w;
    int remainingS = 6 - s;

    for (int i = 0; i < remainingR; i++) {
      for (int j = 0; j < remainingW; j++) {
        for (int k = 0; k < remainingS; k++) {
          boolean[] result = new boolean[remainingR + remainingW + remainingS - 3];
          tally += choose(6, 0, 0, result);
        }
      }
    }
    return tally;
  }

  public static int choose(int k, int c, int idx, boolean[] result) {
    if (c >= k) {
      return 1;
    } else if (idx >= result.length)
      throw new RuntimeException("idx out of bounds");

    int ret = 0;
    for (int i = idx; i <= result.length - (k - c); i++) {
      // choose i
      result[i] = true;
      ret += choose(k, c + 1, i + 1, result);
      // unchoose i
      result[i] = false;
    }
    return ret;
  }

  public static void main(String[] args) {
    System.out.println(enumerate(1,1,4));
  }
}
